﻿<!--
//===============================================================================
// Mammoth Data Analysis Platform
//===============================================================================
// Copyright (C) 2008-2009 Arkadiusz Świerczek and Piotr Włodek.
// All rights reserved.
//===============================================================================
// Defines user interface for the ProgressView.
//===============================================================================
-->

<Controls:ChromeWindow x:Class="WpfRcp.Views.Windows.StatusWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:WpfRcp.Controls;assembly=WpfRcp.Controls"
    xmlns:Helpers="clr-namespace:WpfRcp.Helpers" xmlns:Status="clr-namespace:WpfRcp.Services.Status" 
    xmlns:Behaviors="clr-namespace:WpfRcp.Controls.Behaviors;assembly=WpfRcp.Controls" Title="{Binding Source={x:Static Helpers:ResHelper.Instance}, Path=Resource[Status]}" 
    WindowStartupLocation="CenterOwner"
    ShowInTaskbar="False" ChromeWindowStyle="Normal" SnapsToDevicePixels="True" Behaviors:WindowBehavior.HideInsteadClose="True"
    Background="{DynamicResource WindowBackground}" Style="{StaticResource SingleChromeWindowStyleKey}">

    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="boolToVisibilityConverter" />

        <HierarchicalDataTemplate DataType="{x:Type Status:RcpStatusMonitor}" ItemsSource="{Binding SubtaskMonitors}">
            <DockPanel>
                <TextBlock DockPanel.Dock="Top" Foreground="White" FontSize="16" FontWeight="Bold" Text="{Binding TaskName}" />
                <ProgressBar DockPanel.Dock="Left" Value="{Binding WorkDone, Mode=OneWay}" Maximum="{Binding TotalWork}" IsIndeterminate="False" Height="20" Width="400" Margin="12,8,12,8" />
                <Button DockPanel.Dock="Right" Click="CancelClick" Content="{Binding Source={x:Static Helpers:ResHelper.Instance}, Path=Resource[Cancel]}" Visibility="{Binding Cancelable, Converter={StaticResource boolToVisibilityConverter}}" />
            </DockPanel>
        </HierarchicalDataTemplate>

        <HierarchicalDataTemplate DataType="{x:Type Status:SimpleRcpStatusMonitor}">
            <DockPanel>
                <TextBlock DockPanel.Dock="Top" Foreground="White" FontSize="16" FontWeight="Bold" Text="{Binding TaskName}" />
                <TextBlock DockPanel.Dock="Bottom" Foreground="White" FontSize="12" FontWeight="Bold" Text="{Binding SubtaskName}" />
                <ProgressBar DockPanel.Dock="Left" IsIndeterminate="True" Height="20" Width="400" Margin="12,8,12,8" />
                <Button DockPanel.Dock="Right" Click="CancelClick" Content="{Binding Source={x:Static Helpers:ResHelper.Instance}, Path=Resource[Cancel]}" Visibility="{Binding Cancelable, Converter={StaticResource boolToVisibilityConverter}}" />
            </DockPanel>
        </HierarchicalDataTemplate>
    </Window.Resources>

    <TreeView ItemsSource="{Binding Monitors}" />
</Controls:ChromeWindow>
